package com.gjm.demo.controller;

import com.gjm.demo.model.UserInfo;
import com.gjm.demo.service.UserInfoService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/userInfo")
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    @RequestMapping("/getUserInfo")
    public List<UserInfo> getUserInfoByID(Integer id) {
        List<UserInfo> list = userInfoService.getUserInfoByID(id);
        list.stream().forEach(x -> System.out.println(x));
        return list;
    }

    @RequestMapping("/getUserInfo2")
    public UserInfo getAuthorMessage() {
        return userInfoService.returnAuthorMessage();
    }
}
